// 引入Count的UI组件
import CountUI from '../../components/Count'
// 引入store
// import store from '../../redux/store'
import { addAction, minusAction, asyncAction } from '../../redux/count_action'
// 引入connect用于连接UI组件与redux
import { connect } from 'react-redux'


// 创建并暴露一个Count的容器组件
export default connect(
    state => ({ count: state }),
    /** 一般写法 */
    // dispatch => ({
    //     jia: (data) => dispatch(addAction(data * 1)),
    //     jian: (data) => dispatch(minusAction(data * 1)),
    //     asyncJia: (data, date) => dispatch(asyncAction(data * 1, date))
    // })

    /** 简写
     * react-reudx 在API层面做了优化，帮我们处理dispatch
     */
    {
        jia: addAction,
        jian: minusAction,
        asyncJia: asyncAction
    }
)(CountUI)